﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using nERP.Model;
using nERP.Model.Wms;
using nERP.Model.So;
using nERP.Model.Bas;

namespace nERP.Model.Wms
{
    /// <summary>
    /// 销售出库明细
    /// </summary>
	[Table("SaleOutWarehouseDetail")]
    [SoftKey(nameof(SaleOutWarehouseDetail.SaleOutWarehouseDetailCode))]
    [Display(Name = "_Model.SaleOutWarehouseDetail")]
    public class SaleOutWarehouseDetail : BasePoco, ITenant
    {
        [Display(Name = "_Model._SaleOutWarehouseDetail._Seq")]
        [Comment("序号")]
        public int? Seq { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._SaleOutWarehouseDetailCode")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("销售出库明细单号")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [CanNotEdit]
        public string SaleOutWarehouseDetailCode { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._SaleOutWarehouse")]
        [Comment("销售出库")]
        [NotMapped]
        public SaleOutWarehouse SaleOutWarehouse { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._SaleOutWarehouse")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("销售出库")]
        public string SaleOutWarehouseId { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._Sale")]
        [Comment("销售订单")]
        [NotMapped]
        public Sale Sale { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._Sale")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("销售订单")]
        public string SaleId { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._SaleDetail")]
        [Comment("销售明细")]
        [NotMapped]
        public SaleDetail SaleDetail { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._SaleDetail")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("销售明细")]
        public string SaleDetailId { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._Goods")]
        [Comment("商品")]
        [NotMapped]
        public Goods Goods { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._Warehouse")]
        [Comment("仓库")]
        [NotMapped]
        public Warehouse Warehouse { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._Warehouse")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("仓库")]
        public string WarehouseId { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._Goods")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("商品")]
        public string GoodsId { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._GoodsName")]
        [StringLength(64, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("商品名称")]
        public string GoodsName { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._GoodsSpec")]
        [StringLength(64, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("商品规格")]
        public string GoodsSpec { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._GoodsUnit")]
        [StringLength(32, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("计量单位")]
        public string GoodsUnit { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._SaleOutNumber")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("出库数量")]
        public decimal? SaleOutNumber { get; set; }
        [Display(Name = "_Model._SaleOutWarehouseDetail._Status")]
        [Comment("状态")]
        public dStatusTypeEnum? Status { get; set; } = dStatusTypeEnum.Unaudited;
        [Display(Name = "_Model._SaleOutWarehouseDetail._Remark")]
        [StringLength(256, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("备注")]
        public string Remark { get; set; }
        [Display(Name = "_Model._SaleReturnDetail._SaleOutWarehouseDetail")]
        [InverseProperty("SaleOutWarehouseDetail")]
        [NotMapped]
        [SoftFK(nameof(nERP.Model.So.SaleReturnDetail.SaleOutWarehouseDetailId))]
        public List<SaleReturnDetail> SaleReturnDetail_SaleOutWarehouseDetail { get; set; }
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

    }

}
